<?php

namespace app\index\controller;

use think\Controller;
use think\Request;

class Page extends Common
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        $cid=(int)input('id');
        $cate=db('cate')->where('id',$cid)->find();//当前栏目信息
        //判断指定栏目的跳转
    	if(!$cate['jump_id']==0){
    		$cid=$cate['jump_id'];
    		$cate=db('cate')->find($cid);//查询跳转栏目信息
        }
        $temp=$cate['index_tmp'];//获取当前栏目模板
        $curr=$this->getTopId($cid);
        $topcate=db('cate')->find($curr);//顶级栏目信息
        $son=db('cate')->where(array('pid'=>$curr))->select();//当前栏目下的所有二级栏目
        $pos=$this->getPos($cid);//面包屑导航
        $art=db('archives')->where('cid',$cid)->select();
        $this->assign([
            'cate'    =>$cate,
            'cid'     =>$cid,
            'son'     =>$son,
            'curr'    =>$curr,
            'topcate' =>$topcate,
            'pos'     =>$pos,
            'art'     =>$art,

        ]);
        return $this->fetch($this->temp.'/'.$temp);
    }
    

    
}
